package com.run.cat.base;

import com.baomidou.mybatisplus.mapper.BaseMapper;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.plugins.Page;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;

import java.util.List;

/**
 * 业务层基础实现类
 * @author zyg
 * @date 2018年10月16日
 */
public class BaseServiceImpl<m extends BaseMapper<T>,T> extends ServiceImpl<BaseMapper<T>, T> implements BaseService<T> {

	@Override
	public T queryOne(T t) {
		EntityWrapper<T> wrapper = new EntityWrapper<T>(t);
		return selectOne(wrapper);
	}


	@Override
	public List<T> queryList(T t) {
		EntityWrapper<T> wrapper = new EntityWrapper<T>(t);
		return selectList(wrapper);
	}

	@Override
	public Page<T> queryPage(T t,int current,int size) {
		Page<T> page = new Page<T>(current,size);
		EntityWrapper<T> wrapper = new EntityWrapper<T>(t);
		Page<T> pages = selectPage(page,wrapper);
		return pages;
	}

	@Override
	public Page<T> queryPage(EntityWrapper<T> wrapper, int current, int size) {
		Page<T> page = new Page<T>(current,size);
		Page<T> pages = selectPage(page,wrapper);
		return pages;
	}


}
